package com.spzx.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.spzx.product.api.domain.Brand;
import com.spzx.product.mapper.BrandMapper;
import com.spzx.product.service.BrandService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * <p>
 * 分类品牌 服务实现类
 * </p>
 *
 * @author atguigu
 * @since 2024-10-26
 */
@Service
public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements BrandService {


    @Autowired
    private BrandMapper brandMapper;

    @Override
    public List<Brand> getPageList(String name) {
        LambdaQueryWrapper<Brand> brandLambdaQueryWrapper=new LambdaQueryWrapper<>();
        brandLambdaQueryWrapper.like(StringUtils.hasText(name),Brand::getName,name);
        List<Brand> brandList = brandMapper.selectList(brandLambdaQueryWrapper);
        return brandList;
    }
}
